<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>校验回调方法</title>
    <script type="text/javascript" src="../../../jquery.js"></script>
    <script type="text/javascript" src="../../../ui/om-validate.js"></script>
    <link rel="stylesheet" type="text/css" href="../../common/css/demo.css" />
    <!-- view_source_begin -->
    <script type="text/javascript">
        $(document).ready(function() {
            $("#reg").validate({
                submitHandler : function() {
                    alert("submit handler");
                },
    
                invalidHandler : function() {
                    alert("invalid handler");
                },
    
                rules : {
                    username : "required",
                    password : {
                        required : true,
                        minlength : 5,
                        maxlength : 10,
                    },
                    provider : {
                        required : true,
                        omui : true
                    }
                },
                messages : {
                    username : {
                        required : "请输入用户名"
                    },
                    password : {
                        required : "请输入密码",
                        minlength : "密码长度不够",
                    }
                }
            });
        });
    </script>
    <!-- view_source_end -->
</head>
<body>
    <!-- view_source_begin -->
    <form action="test.action" id="reg">
        <input type="text" name="username" />
        <input type="text" name="password" />
        <input type="submit" value="提交" />
    </form>
    <!-- view_source_end -->
    <div id="view-desc">定制校验插件的一些回调方法，如提交时校验出错回调和提交时校验通过回调。</div>
</body>
</html>